﻿//===================================================================
// 西交通开发框架-XCI.Parent 2019 版权所有     
//===================================================================
using System;
using System.ComponentModel.DataAnnotations;
using XCI.Core;

namespace XCI.Sys.Model
{
    /// <summary>
    /// 系统字典类型
    /// </summary>
    [ApiModel(Caption = "系统字典类型")]
    public class SysDicCategory
    {
        /// <summary>
        /// 字典类型主键
        /// </summary>
        [Display(Name = "字典类型主键",AutoGenerateField = false)]
        [ApiModelProperty(PrimaryKey = true)]
        public string Id { get; set; }

        /// <summary>
        /// 上级主键
        /// </summary>
        [Display(Name = "上级主键", AutoGenerateField = false)]
        [ApiModelProperty(ParentKey = true)]
        public string ParentId { get; set; }

        /// <summary>
        /// 字典类型
        /// </summary>
        [Display(Name = "字典类型")]
        public string NameCode => $"{Name} - {Code}";

        /// <summary>
        /// 字典类型名称
        /// </summary>
        [Display(Name ="字典类型名称", AutoGenerateField = false)]
        [Required(ErrorMessage = "请输入字典类型名称")]
        [StringLength(100, ErrorMessage = "字典类型名称不能超过100个字符")]
        public string Name { get; set; }

        /// <summary>
        /// 字典类型编码
        /// </summary>
        [Display(Name = "字典类型编码", AutoGenerateField = false)]
        [Required(ErrorMessage = "请输入字典类型编码")]
        [StringLength(100, ErrorMessage = "字典类型编码不能超过100个字符")]
        public string Code { get; set; }

        /// <summary>
        /// 字典类型简拼
        /// </summary>
        [Display(Name ="字典类型简拼", AutoGenerateField = false)]
        [StringLength(100, ErrorMessage = "字典类型简拼不能超过100个字符")]
        public string Spell { get; set; }

        /// <summary>
        /// 排序路径
        /// </summary>
        [Display(Name = "序号", AutoGenerateField = false)]
        [ApiModelProperty(PathKey = true)]
        public int Path { get; set; }

        /// <summary>
        /// 备注
        /// </summary>
        [Display(Name = "备注", AutoGenerateField = false)]
        [StringLength(500, ErrorMessage = "备注不能超过500个字符")]
        public string Remark { get; set; }

        /// <summary>
        /// 复制对象
        /// </summary>
        public SysDicCategory Clone()
        {
            return (SysDicCategory)MemberwiseClone();
        }
    }
}